from abc import ABC
from concurrent.futures import ThreadPoolExecutor

import tornado
from tornado.concurrent import run_on_executor

from config import configuration
from config2.config import global_config
# from log_config import get_logger

from util.logger_config import logger

# logger = get_logger("index")


class SystemHandler(tornado.web.RequestHandler, ABC):
    executor = ThreadPoolExecutor(10)

    def _initialize(self) -> None:
        pass

    @run_on_executor
    def get(self):
        reg_server_url = configuration.get('db-server', 'REG_SERVER_URL')
        logger.info("%s" % reg_server_url)
        self.write("System Info")

    @run_on_executor
    def post(self):
        logger.info("%s" % global_config.getRaw("config", "sku_id"))
        self.write("System Info")

    @run_on_executor
    def put(self):
        logger.info("%s" % global_config.getRaw("config", "sku_id"))
        self.write("System Info")
